//
//  UIView+ZXAlignmentRectInsets.h
//  YiShangbao
//
//  Created by simon on 2018/6/27.
//  Copyright © 2018年 com.Microants. All rights reserved.
//
//  当前视图渲染inset后，内部子元素布局依然是跟原真实的view布局的，类似view的padding功能；UIView{inset:UIEdgeInsetsMake(-2, 0, -8, 0)}
//  2018.6.27 新增
//  2021.8.04 优化代码，改变从原来的字符串改为UIEdgeInsets；待研究另外的2个重写属性；


#import <UIKit/UIKit.h>
#import <objc/runtime.h>


@interface UIView (ZXAlignmentRectInsets)


/// 注意：子元素并不会一起inset
@property (nonatomic, assign) UIEdgeInsets rectInsets;


@end

/*
 子元素的位置依然是以原父视图的真实frame定约束的，使用rectInsets后，需要特殊处理：
 
 UIEdgeInsets inset = UIEdgeInsetsMake(-2, 0, -8, 0);
 self.desContainerView.rectInsets = inset;

 [self.picCollectionView mas_makeConstraints:^(MASConstraintMaker *make) {
     make.top.mas_equalTo(self.desContainerView.mas_top).with.offset(ABS(inset.top));
     make.left.mas_equalTo(self.desContainerView.mas_left);
     make.centerX.mas_equalTo(self.desContainerView.mas_centerX);
     make.bottom.mas_equalTo(self.desContainerView.mas_bottom).with.offset(inset.bottom);
 }];
*/
